#include "MulticastSocket.h"

MulticastSocket::MulticastSocket(const char* pGroupIP) : BufferedSocket(Socket(Protocol_Udp))
{
    mGroupIP = pGroupIP;
    struct ip_mreq mreq;
    mreq.imr_multiaddr.s_addr=inet_addr(mGroupIP);
    mreq.imr_interface.s_addr=htonl(INADDR_ANY);
    if (setsockopt(GetSocketDescriptor(),IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq)) < 0) {
        Error();
    }
}

MulticastSocket::~MulticastSocket()
{
    //dtor
}
